#!/bin/bash

camera_id=1629778878
#camera_route=$(curl "http://10.143.144.201:8699/data-video/video/query/camera/info?cameraId=${camera_id}"|jq -r '.data.streamUrl | split("/")[-1]')
camera_url=$(curl "http://10.143.144.201:8699/data-video/video/query/camera/info?cameraId=${camera_id}"|jq -r '.data.streamUrl')
host=10.143.145.211

ffmpeg -rtsp_transport tcp -i ${camera_url}  -probesize 5000 -timeout 2000 -map 0:v -ignore_unknown -vf "scale=1920:1080" -c:v libx264 -crf 28 -preset veryslow -an -r 16 -f segment -segment_time 1800 -segment_format_options movflags=+faststart -strftime 1 -loglevel debug "test_%Y-%m-%d_%H-%M-%S.mp4" 2>&1 | gawk '{ print strftime("[%Y-%m-%d %H:%M:%S]"), $0; fflush(); }' | tee >(split -d -b 100M - "log_")

